1. Field of the Invention
The invention relates to the field of processing floating point numbers in a computer system.
2. Art Background
Floating Point Formats:
Floating point numbers are typically represented in a computer system using a sign, an exponent, and a significand. The significand represents the number of bits of precision of the number. The exponent defines the range of the number, and is bounded by the values Emax (maximum exponent) and Emin (minimum exponent). The sign represents the sign of the number, either positive or negative. Using these three fields, floating point numbers are represented in the form EQU (-1).sup.s 2.sup.E (b.sub.0.b.sub.1 b.sub.2 b.sub.3.b.sub.p-1)
where:
s=the sign bit, 0 or 1 PA0 E=the exponent, any integer between Emin and Emax, inclusive PA0 bi=a significand bit, 0 or 1 PA0 p=number of significand bits (precision) PA0 .=implied decimal point PA0 The biased floating-point exponent is stored at its smallest value. For single precision numbers, this minimum exponent value is -126. For double precision, the minimum exponent value is -1022. For the extended precision format, the minimum exponent value is -16382. PA0 For all formats, when the number is denormal the minimum exponent is encoded with a bit pattern of all zeros. PA0 The integer bit of the significand (whether explicit or implicit) is zero. PA0 "Compute in Extended Precision" PA0 "Compute In Destination Precision"
A floating point number has p bits of precision in the significand field, b.sub.0.b.sub.1 b.sub.2 b.sub.3.b.sub.p-1, which represent the number's significant digits. (The term `significand` is analogous to the term `mantissa` used to describe floating-point numbers on some conventional computers). The exponent field, E, locates the binary point within the significant digits (and therefore determines the number's magnitude). The term `exponent` is analogous to the term `characteristic` used to describe floating-point numbers on some conventional computers. The decimal point is not explicitly stored in the number, although its position is implied. Also, the significand bit b0 to the left of the decimal point may be implied as well. A 1-bit sign field, s, indicates whether the number is positive or negative. Negative numbers differ from positive numbers only in the sign bits of their significands.
For example, the number -260.00 can be represented as:
1 00001000 00000100000000000000000
where the sign bit is 1 (indicating a negative number), the exponent is 00001000 (8.sub.2), and the significand is 1.00000100000000000000000, where the leading 1 and decimal point are implicit.
TABLE 1 ______________________________________ Single Double Extended ______________________________________ Total Format 32 64 80 Width p (bits of 23 53 64 precision) Exponent bits 8 11 15 Emax +127 +1023 +16383 Emin -126 -1022 -16382 Exponent Bias +127 +1023 +16383 ______________________________________
Table 1 describes the fields of each of three real-number formats; single, double, and extended.
The exponent determines a real number's magnitude. The exponent is typically stored in a biased form. A constant, called the bias, is added to the true exponent of the number to obtain a biased exponent. The bias is different for each real format. The bias is chosen so as to force the biased exponent to be a positive value. A number's true exponent can be determined simply by subtracting the bias value of its format from the exponent.
When a numeric value becomes very close to zero, normalized floating-point storage cannot be used to express the value accurately. A number R is said to be denormal when -2Emin&lt;R&lt;0 or 0&lt;R&lt;+2Emin. (For a typical case, Emin is -126 for single format, -1022 for double format, and -16382 for extended format.) In other words, a nonzero number is denormal if its exponent would be too negative to store in the destination format, while retaining the number in normalized form.
To accommodate denormal numbers, the processor can store and operate on real numbers that are not normalized, i.e., whose significands contain one or more leading zeros. Denormal numbers typically arise when the result of a calculation yields a value that is too small to represent in the destination format.
Denormal values have the following properties:
Interpretation of the exponent for denormal numbers differs from the interpretation of the exponent encoding for normalized numbers. For denormalized numbers, the exponent is encoded with the bit pattern of all zeros. However, this pattern is interpreted by the processor to have a value which is the minimum exponent value for the format (which is -126 for single format, -1022 for double real format, and -16382 for the extended real format). Hence, interpreting such denormal numbers by merely adding the bias of the format to the exponent encoding of the denormal number will produce an exponent value that is off by one. Denormals and true zeros both have exponents encoded with all zeros, although the interpretation of these encodings differ.
Numeric Computation Rules
To achieve consistent and reliable results from the computation, certain rules or conventions (relating to the operating precision and range of each computation) must be followed during numeric operations. Rules are defined for handling operands of mixed precision, and for the computation of intermediate values. IEEE standard 754-1985 allows for two important conventions for handling operands with mixed precisions, and for intermediate computations. These will be henceforth referred to as:
The detailed computation rules specified in the IEEE standard 754-1985 will not all be repeated here, and may be found in the official document. However, a short summary of the distinguishing characteristics is provided below.